#include <boost/test/unit_test.hpp>

#include "customer.h"

using namespace std;
using namespace aviation;

BOOST_AUTO_TEST_CASE(TestCustomerDefaultConstructor)
{
	//Constructs an object with an appropriate string
	Customer customer1;
	std::string str = customer1.AsString();
	BOOST_REQUIRE(str == ("AA AAA AAA AAAAAAAAAA AAAAAAAAA 11111111"));
}

BOOST_AUTO_TEST_CASE(TestCustomerConstructor)
{
	// A customer infor. with good input
	Customer customer1(string("Mr"),string("Tim"),string("Smith"),string("Claverton town Bath"),string("BAC123456"),string("074597612"));

	// Check correct output
	BOOST_REQUIRE(customer1.AsString() == "Mr Tim Smith Claverton town Bath BAC123456 074597612");

	///Test the following bad inputs.Each one should cause an exception (error message) to be thrown,
	BOOST_CHECK_THROW(Customer(string(""),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612")), exception);
	BOOST_CHECK_THROW(Customer(string("Mr"),string(""),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612")), exception);
	BOOST_CHECK_THROW(Customer(string("Mr"),string("Tim"),string(""),string("ClevertontownBath"),string("BAC123456"),string("074597612")), exception);
	BOOST_CHECK_THROW(Customer(string("Mr"),string("Tim"),string("Smith"),string(""),string("BAC123456"),string("074597612")), exception);
	BOOST_CHECK_THROW(Customer(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC1234561"),string("074597612")), exception);
	BOOST_CHECK_THROW(Customer(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC12345"),string("074597612")), exception);
	BOOST_CHECK_THROW(Customer(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597")), exception);
	BOOST_CHECK_THROW(Customer(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("07459761245646565")), exception);
	
}

BOOST_AUTO_TEST_CASE(TestCustomerCopyConstructor)
{
	// Copies the Customer from another.
	Customer customer1(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));
	Customer customer2(customer1);
	BOOST_REQUIRE(customer1.AsString() == customer2.AsString());

}

BOOST_AUTO_TEST_CASE(TestCustomerAssignmentOperator)
{
	// Assignment operator, copies from 'other'
	Customer customer1(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));
	Customer customer2;
	customer2 == customer1;
	BOOST_REQUIRE(customer1.AsString() == customer1.AsString());
}

BOOST_AUTO_TEST_CASE(TestCustomerComparisonEqualOperator)
{
	//Returns true if they are the same, or false if they arent
	Customer customer1(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));
	Customer customer2(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));

	BOOST_REQUIRE(customer1 == customer2);


}

BOOST_AUTO_TEST_CASE(TestCustomerNotComparisonEqualOperator)
{
	//Returns true if they are not the same, or false if they are
	Customer customer1(string("Mr"),string("Tm"),string("Smih"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));
	Customer customer2(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));

	BOOST_REQUIRE(customer1 != customer2);


}

BOOST_AUTO_TEST_CASE(TestCustomerComparisonLessthanOperator)
{
	//Returns true if they are the same, or false if they arent
	Customer customer1(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));
	Customer customer2(string("Mr"),string("Tin"),string("Smmth"),string("ClevertontownBath"),string("BAC123457"),string("074598612"));

	BOOST_REQUIRE(customer1 < customer2);

}

BOOST_AUTO_TEST_CASE(TestGetTitle)
{
	//return the title
    Customer customer1(string("Miss"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));

	BOOST_REQUIRE(customer1.GetTitle() == "Miss");

}

BOOST_AUTO_TEST_CASE(TestGetFirstName)
{
	//return the firstname
    Customer customer1(string("Miss"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));

	BOOST_REQUIRE(customer1.GetFirstName() == "Tim");

}

BOOST_AUTO_TEST_CASE(TestGetLastName)
{
	//return the last name
    Customer customer1(string("Miss"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));

	BOOST_REQUIRE(customer1.GetLastName() == "Smith");

}


BOOST_AUTO_TEST_CASE(TestGetAddress)
{
	//return the Address
    Customer customer1(string("Miss"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));

	BOOST_REQUIRE(customer1.GetAddress() == "ClevertontownBath");

}

BOOST_AUTO_TEST_CASE(TestGetPassportNumber)
{
	//return the Passportnumber
    Customer customer1(string("Miss"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));

	BOOST_REQUIRE(customer1.GetPassportNumber() == "BAC123456");

}

BOOST_AUTO_TEST_CASE(TestGetTelephoneNumber)
{
	//return the telephonenumber
    Customer customer1(string("Miss"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));

	BOOST_REQUIRE(customer1.GetTelephoneNumber() == "074597612");

}

BOOST_AUTO_TEST_CASE(TestGetCustomerID)
{
	//return the ID
    Customer customer1(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));
	Customer customer2(string("Mr"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));

	BOOST_REQUIRE(customer1.GetID() == customer2.GetID());

}

BOOST_AUTO_TEST_CASE(TestgetcustomerAsString)
{
	//return the AsString
    Customer customer1(string("Miss"),string("Tim"),string("Smith"),string("ClevertontownBath"),string("BAC123456"),string("074597612"));

	BOOST_REQUIRE(customer1.AsString() == "Miss Tim Smith ClevertontownBath BAC123456 074597612");

}